package Threadtext;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2023-03-03
 * Time: 13:54
 */
public class Thrad2 {
    public static void main(String[] args) throws InterruptedException {
        Thread[] threads = new Thread[20];
        for (int i = 0; i < 20; i++) {
            final int n = i;
            threads[i] = new Thread(() -> {
                System.out.print(n+" ");
            });
        }
            for (Thread t : threads){
               t.start();
            }
            for (Thread t :threads){
                t.join();
            }

        System.out.println("ok");
    }
}
